<template>
  <!-- 登录页面不显示顶部栏和侧边栏 -->
  <div v-if="isLoginPage">
    <router-view />
  </div>
  
  <!-- 其他页面显示完整布局 -->
  <el-container v-else style="height: 100vh;">
    <!-- 顶部栏 -->
    <el-header style="background: linear-gradient(90deg, #2d3e50 0%, #4b6cb7 100%); display: flex; align-items: center; justify-content: space-between; box-shadow: 0 2px 8px #0001;">
      <div style="font-family: 'KaiTi', '楷体', serif; font-size: 30px; color: #fff; letter-spacing: 2px;">
        智学云帆-教学管理系统
      </div>
      <UserInfo />
    </el-header>
    <el-container>
      <!-- 侧边栏 -->
      <el-aside width="220px" style="background: linear-gradient(180deg, #e3eafc 0%, #cfd9df 100%); box-shadow: 2px 0 8px #0001; min-height: 100vh;">
        <Sidebar />
      </el-aside>
      <!-- 主体内容 -->
      <el-main style="background: #fff;">
        <router-view />
      </el-main>
    </el-container>
  </el-container>
</template>

<script setup>
import { computed } from 'vue'
import { useRoute } from 'vue-router'
import Sidebar from './components/Sidebar.vue'
import UserInfo from './components/UserInfo.vue'

const route = useRoute()

// 判断当前是否是登录页面
const isLoginPage = computed(() => {
  return route.path === '/login'
})
</script> 

<style>
html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: 'Helvetica Neue', Helvetica, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', '微软雅黑', Arial, sans-serif;
}

* {
  box-sizing: border-box;
}
</style> 